//
//  CABasicAnimation+XLExtension.m
//  TPS
//
//  Created by 左学良 on 16/6/15.
//  Copyright © 2016年 TPS. All rights reserved.
//

#import "CABasicAnimation+XLExtension.h"

@implementation CABasicAnimation (XLExtension)

#pragma mark ====旋转动画======

+ (CABasicAnimation *)rotation:(float)dur degree:(float)degree direction:(int)direction repeatCount:(int)repeatCount
{
    CATransform3D rotationTransform = CATransform3DMakeRotation(degree, 0, 0, direction);
    CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform"];
    animation.toValue = [NSValue valueWithCATransform3D:rotationTransform];
    animation.duration  =  dur;
//    animation.autoreverses = NO;
//    animation.cumulative = YES;
    //1.2设置动画执行完毕之后不删除动画
    animation.removedOnCompletion=NO;
    //设置保存动画的最新状态
    animation.fillMode=kCAFillModeForwards;
    animation.repeatCount = repeatCount;    
    return animation;
}
@end
